package test.unit
{
	import com.zanshine.benchmark.core.CaseDescriptor;
	import com.zanshine.benchmark.core.TestDescriptor;
	
	import flash.utils.getQualifiedClassName;
	
	import net.digitalprimates.fluint.tests.TestCase;

	public class CaseDescriptorTest extends TestCase
	{
		private var cDescriptor:CaseDescriptor;
		
		override protected function setUp():void
		{
			cDescriptor = new CaseDescriptor(new Mock);
		}
		
		public function testClassName():void
		{
			assertEquals(getQualifiedClassName(new Mock), cDescriptor.className);
		}
		
		public function testMethodsCount():void
		{
			assertTrue(cDescriptor.tests.length == 3);
		}
		
		public function testMethodsNames():void
		{
			var flag:Boolean;
			for each(var name:String in Mock.BENCH_METHODS_NAMES)
			{
				flag = false;
				for each(var meth:TestDescriptor in cDescriptor.tests)
				{
					if(meth.name == name)
					{
						flag = true;
						break;
					}
				}
				assertTrue(flag);
			}
		}
		
		
	}
}

import com.zanshine.benchmark.core.BenchmarkCase;	

class Mock extends BenchmarkCase
{
	public static const BENCH_METHODS_NAMES:Array = 
	[
		"firstBenchmarkableMethod",
		"secondBenchmarkableMethod",
		"lastBenchmarkableMethod"
	];
	
	public function simpleMethod(arg:uint):void
	{
		
	}
	
	[Benchmark(message="value with key")]
	public function firstBenchmarkableMethod():void
	{
		
	}
	
	[Benchmark("value only")]
	public function secondBenchmarkableMethod():void
	{
		
	}
	
	[Benchmark]
	public function lastBenchmarkableMethod():void
	{
		
	}
	
}

function contain(string:String, array:Array):Boolean
{
	for each(var item:String in array)
	{
		if(item === string) return true;
	}
	return false;
}